import socket


def start_tcp_client(ip, port):

    tcp_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

    try:
        # tcp_client.bind(('192.168.1.6', 11560))
        tcp_client.connect((ip, port))
    except socket.error:
        print('fail to setup socket_test connection')
    else:
        print('sending..........')
        tcp_client.sendall("echo message")

        print('reading...........')
        print(tcp_client.recv(1024))
    tcp_client.close()


def main():
    start_tcp_client("localhost", "50008")


if __name__ == '__main__':
    main()